<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>修改設備資料</title>
</head>
<body>
<% if(session.getAttribute("access") == "y" ){%>
<jsp:useBean id="mydb" scope="page" class="bean.ConDbBean"/> <%//連結資料庫的bean %>
<%
String id = new String(request.getParameter("fid").getBytes("iso-8859-1"),"utf-8"); //防止亂碼
String oldid = new String(request.getParameter("oldid").getBytes("iso-8859-1"),"utf-8");
String fclass=new String(request.getParameter("class").getBytes("iso-8859-1"),"utf-8");
String name = new String(request.getParameter("fname").getBytes("iso-8859-1"),"utf-8");
String detail = new String(request.getParameter("fdetail").getBytes("iso-8859-1"),"utf-8");
String state = new String(request.getParameter("fstate").getBytes("iso-8859-1"),"utf-8");
String ps = new String(request.getParameter("fps").getBytes("iso-8859-1"),"utf-8");
String sql="UPDATE FACILITY SET F_ID='"+id+"',F_NAME='"+name+"',F_STATE='"+state+"',F_DETAIL='"+detail+"',PS='"+ps+"',F_CLASS='"+fclass+"' WHERE F_ID='"+oldid+"'";
mydb.executeUpdate(sql);
response.sendRedirect("lookFacility.jsp"); //直接跳頁到lookFacility.jsp
%>
<%
  }
  else{
  	response.sendRedirect("../index.jsp"); //若沒有登入則回到index.jsp
  } 
  %>
</body>
</html>